#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <qfiledialog.h>


MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->table->setRowCount(1);
    ui->table->setColumnCount(5);
    ui->table->setHorizontalHeaderItem(0,new QTableWidgetItem("ФИО"));
    ui->table->setHorizontalHeaderItem(1,new QTableWidgetItem("РцИС"));
    ui->table->setHorizontalHeaderItem(2,new QTableWidgetItem("Математика"));
    ui->table->setHorizontalHeaderItem(3,new QTableWidgetItem("ИТ"));
    ui->table->setHorizontalHeaderItem(4,new QTableWidgetItem("СВЧ"));
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_table_doubleClicked(const QModelIndex &index)
{
    column=index.column();
  if(column!=0){
    row=index.row();
   edit=new QComboBox;
   ui->temp->setText("<Не выбрано>");
   edit->addItem("<Не выбрано>",0);
   edit->addItem("Неуд",2);
   edit->addItem("удовл",3);
   edit->addItem("хор",4);
   edit->addItem("отл",5);
   ui->table->setCellWidget(row,column,edit);
   connect(edit,SIGNAL(currentIndexChanged(QString)),ui->temp,SLOT(setText(QString)));

  }
}

void MainWindow::on_temp_textChanged(const QString &arg1)
{
  if(arg1!="<Не выбрано>"){
   ui->table->setItem(row,column,new QTableWidgetItem(arg1));
delete edit;
  }
}

void MainWindow::on_pbopen_clicked()
{
    QString path=QFileDialog::getOpenFileName(0,"Open file","","tr(txt(*.txt)");

}
